import java.util.ArrayList;
import java.util.List;

/**
 * 剑指 Offer 43. 1～n 整数中 1 出现的次数
 * https://leetcode-cn.com/problems/1nzheng-shu-zhong-1chu-xian-de-ci-shu-lcof/
 */
public class Solutions_Offer_43 {
    public static void main(String[] args) {
        int n1 = 13;  // output: 6
        int n2 = 12;  // output: 5
        int n3 = 123;  // output: 57
        int n4 = 108;  // output: 30

        List<Integer> inputs = new ArrayList<>();
        inputs.add(n1);
        inputs.add(n2);
        inputs.add(n3);
        inputs.add(n4);

        for (int input : inputs) {
            int result = countDigitOne(input);
            System.out.println(result);
        }
    }


    public static int countDigitOne(int n) {
        return Solutions_233.countDigitOne(n);
    }
}
